package com.lijing.SingleLinkedList;

public class SingleLinkedListDemo {
    public static void main(String[] args) {
        HeroNode heroNode1 = new HeroNode(1,"宋江","及时雨");
        HeroNode heroNode2 = new HeroNode(2,"卢俊义","玉麒麟");
        HeroNode heroNode3 = new HeroNode(3,"吴用","智多星");
        HeroNode heroNode4 = new HeroNode(4,"林冲","豹子头");
        SingleLinkedList singleLinkedList = new SingleLinkedList();
        singleLinkedList.addByOrder(heroNode1);
        singleLinkedList.addByOrder(heroNode4);
        singleLinkedList.addByOrder(heroNode2);
        singleLinkedList.showList();

        HeroNode heroNode = new HeroNode(2, "小卢", "玉麒麟~~");
        singleLinkedList.update(heroNode);
//        singleLinkedList.del(4);
//        singleLinkedList.del(2);
        //singleLinkedList.del(1);
        System.out.println("更新后的链表为：");
        singleLinkedList.showList();
        System.out.println(SingleLinkedList.getLength(singleLinkedList.getHead()));
        System.out.println(SingleLinkedList.getLastIndex(singleLinkedList.getHead(),1));
//        SingleLinkedList.reverseList(singleLinkedList.getHead());
//        System.out.println("反转后的链表为：");
        singleLinkedList.showList();
        System.out.println("使用栈逆序打印链表为：");
        SingleLinkedList.reversePrint(singleLinkedList.getHead());
    }
}
